/**
 *
 */
package appGUI;

import java.awt.Dimension;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.*;
import utils.Utils;

/**
 * @author Picto
 *
 */
@SuppressWarnings("serial")
public class MainFrame extends JFrame implements WindowListener {

    MainMenuBar mb = new MainMenuBar();
    Utils utility = new Utils();

    public MainFrame() {
        utility.checkForHighScoreFile();
        addWindowListener(this);
        this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        this.setLayout(null);
        mb.setBounds(0, 0, 1000, 20);
        this.add(mb);
        this.setSize(new Dimension(1000, 720));
        this.setResizable(false);
        this.setLocation(200, 200);
        this.setTitle("Hangman");
        this.setVisible(true);
        mb.getMenuListener().setFrame(this);
        mb.getMenuListener().newGame();
    }

    public void showHighscores() {
        HighscoresFrame hf = new HighscoresFrame();
        hf.setVisible(true);
    }
    
    @Override
    public void windowClosing(WindowEvent e) {
        mb.getMenuListener().quitGame();
    }
    
    @Override
    public void windowOpened(WindowEvent e) {
    }

    @Override
    public void windowClosed(WindowEvent e) {
    }

    @Override
    public void windowIconified(WindowEvent e) {
    }

    @Override
    public void windowDeiconified(WindowEvent e) {
    }

    @Override
    public void windowActivated(WindowEvent e) {
    }

    @Override
    public void windowDeactivated(WindowEvent e) {
    }
}
